home *** CD-ROM | disk | FTP | other *** search
- // modular section
- #define MOD_GAME_MAKER ""
- #define MOD_GAME_TITLE "Queen the Eye"
- #define MOD_GAME_PATH "C:\\queen"
- #define BASE_FILE_SIZE 48259176
- #define MOD_STR_FILE_SIZE "57"
- #define MOD_ZFILENAME "queen.z"
-
- // size of operating system files
- #define OS_FILE 13
- #define OS_PATH 128
-
- /********************************************************************
- *
- * declare variables
- *
- ********************************************************************/
- declare
- string szBitmapPath[OS_PATH];
- string szMessage[1024]; // used for MessageBox output
- string szDisk[10]; // disk drive letter
- string szTemp[20]; // used for temp calcs
- string szTarget[OS_PATH]; // temp store for target directory
- string szErrMsg[100]; // error handling
- string szErrFile[OS_FILE]; // error handling
- string TARGET_PATH[OS_PATH];
- string szTempStr[1024]; // added for modularity
- string szTitleStr[1024]; // added for modularity
-
- number nNeeded; // space needed on target
- number nExistSpace; // existing space on target disk
-
- number nTotal; // used to calc percentage of files copied
- number nPercent;
-
- number nDoInstall;
- number nValue;
- number nDx;
- number nDy;
-
- program
-
- Start:
- // Size the Window to FULL SCREEN
- GetExtents ( nDx, nDy);
- SizeWindow( BACKGROUND, nDx, nDy );
-
- // target installation path
- TARGET_PATH = MOD_GAME_PATH;
-
- /********************************************************************
- *
- * start of script
- *
- ********************************************************************/
- // Display Title
- StrCopy( szTitleStr, MOD_GAME_MAKER );
- StrConcat( szTitleStr, " " );
- StrConcat( szTitleStr, MOD_GAME_TITLE );
- StrConcat( szTitleStr, " Installation" );
- SetTitle( szTitleStr, 24, RED);
-
- // position and display the exit button
- PlaceWindow( EXIT, 20, 20, LOWER_RIGHT );
- Enable( EXIT );
-
- // Initialize window titles
- StrCopy( szTempStr, MOD_GAME_TITLE );
- StrConcat( szTempStr, " Install" );
- SetDialogTitle( DLG_ASK_YESNO, szTempStr );
- SetDialogTitle( DLG_ASK_OPTIONS, szTempStr );
- SetDialogTitle( DLG_ASK_PATH, szTempStr );
-
- // see if user wants to install present
- StrCopy( szMessage, "Would you like to install ");
- StrConcat( szMessage, MOD_GAME_TITLE );
- StrConcat( szMessage, ",\n" );
- StrConcat( szMessage, "it takes approximately " );
- StrConcat( szMessage, MOD_STR_FILE_SIZE );
- StrConcat( szMessage, " Meg of hard\n" );
- StrConcat( szMessage, "drive space ?\n" );
- AskYesNo( szMessage, YES );
- if ( LAST_RESULT = YES ) then
- nDoInstall = TRUE;
- call GetInstallDir;
- else
- exit;
- endif;
-
- // carry out users actions
- if ( nDoInstall = TRUE ) then
- call Install;
- endif;
-
- InstallComplete:
- SetStatusWindow( 100, "Installation complete..." );
- Disable( STATUS ); // Status , % Complete Bar Window
-
- // add generic end of install comment
- StrCopy( szMessage, "Installation is complete.\n" );
-
- MessageBox( szMessage, INFORMATION );
-
- exit;
-
- /**********************************************************************
- *
- * get the install directory and check for validity
- *
- ***********************************************************************/
- GetInstallDir:
- // Get path to install IE magazine
- StrCopy( szMessage, MOD_GAME_TITLE);
- StrConcat( szMessage, " will be installed into the\n");
- StrConcat( szMessage, "following directory, which will be created\n");
- StrConcat( szMessage, "on your hard disk.\n");
- StrConcat( szMessage, "If you want to install the game in a different\n");
- StrConcat( szMessage, "directory and/or drive, type the name of the\n");
- StrConcat( szMessage, "directory.");
- AskPath( szMessage, TARGET_PATH, TARGETDIR );
- if ( LAST_RESULT = FALSE ) then
- // check if really want to cancel
- AskYesNo( "Are you sure you want to CANCEL the installation ?", FALSE );
- if ( LAST_RESULT = TRUE ) then
- // user wants to cancel install, return now
- nDoInstall = FALSE;
- return;
- endif;
-
- // user wants to have another shot at installing, loop back
- goto GetInstallDir;
- endif;
-
- // Check If valid disk entered
- GetDisk( TARGETDIR, szDisk );
- ExistsDisk( szDisk );
- if ( LAST_RESULT = NOTEXISTS ) then // Invalid disk entered, reprompt
- StrCopy( szMessage, szDisk);
- StrConcat( szMessage, " - is an invalid disk, press Ok ");
- StrConcat( szMessage, "to return to the path selection");
- MessageBeep(0);
- MessageBox( szMessage, WARNING );
- goto GetInstallDir; // get new path
- endif;
-
- // install here
- // Check to see if enough space is free on the destination drive.
- GetDiskSpace( szDisk );
- Assign( nExistSpace, LAST_RESULT );
-
- // see if existing space is less than what we need
- if ( nExistSpace < BASE_FILE_SIZE ) then
- // get amount of space needed
- Assign( nNeeded, BASE_FILE_SIZE );
- Sub( nNeeded, nExistSpace );
-
- // inform user
- StrCopy( szMessage, "An additional ");
- NumToStr( szTemp, nNeeded);
- StrConcat( szMessage, szTemp);
- StrConcat( szMessage, " bytes of space is required to");
- StrConcat( szMessage, "\ninstall on drive ");
- StrConcat( szMessage, szDisk );
- StrConcat( szMessage, "\nPlease free up this space and reinstall the\n");
- StrConcat( szMessage, "demo");
- MessageBox( szMessage, WARNING );
- goto GetInstallDir; // get new path
- endif;
-
- // see if the target directory exists
- ExistsDir( TARGETDIR );
- if ( LAST_RESULT = NOTEXISTS ) then // if it doesn't exist try to create it
- CreateDir( TARGETDIR );
- if ( LAST_RESULT = NOTEXISTS ) then // couldn't create it
- StrCopy( szMessage, "Unable to create specified path:\n" );
- StrConcat( szMessage, TARGETDIR );
- StrConcat( szMessage, "\nPlease enter a correct path like " );
- StrConcat( szMessage, TARGET_PATH );
- MessageBeep( 0 );
- MessageBox( szMessage, WARNING );
- goto GetInstallDir; // get new path
- endif;
- // if this was a good directory name then we can change to it
- ExistsDir( TARGETDIR );
- if ( LAST_RESULT = NOTEXISTS ) then
- StrConcat( szMessage, TARGETDIR );
- StrCopy( szMessage, "\nis an illegal path name.\n" );
- StrConcat( szMessage, "\nPlease enter a correct path like " );
- StrConcat( szMessage, TARGET_PATH );
- MessageBeep( 0 );
- MessageBox( szMessage, WARNING );
- goto GetInstallDir; // get new path
- endif;
- endif;
-
- return;
-
- /**********************************************************************
- *
- * install
- *
- ***********************************************************************/
- Install:
- Enable( STATUS );
- // Shows all filenames when copied.
- Enable( INDVFILESTATUS );
-
- // start the status bar at 1 with this title
- SetStatusWindow( 1, "Installing files..." );
-
- // make the bar increment, file by file to 100%
- StatusUpdate( ON, 100 );
- CompressGet( MOD_ZFILENAME, "*.*", INCLUDE_SUBDIR );
- if ( LAST_RESULT < 0 ) then
- StrCopy( szErrFile, "Demo Files" );
- call CopyError;
- endif;
-
- // hides file name status
- Disable( INDVFILESTATUS );
- return;
-
- /**********************************************************************
- *
- * reports errors in copying files
- *
- **********************************************************************/
- CopyError:
- // display file copy error message
- StrCopy( szErrMsg, "Unable to copy or decompress files: " );
- StrConcat( szErrMsg, szErrFile );
- MessageBeep( 0 );
- MessageBox( szErrMsg, SEVERE );
- return;
-